package jy.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Ftype entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "ftype", catalog = "waimai")
public class Ftype implements java.io.Serializable {

	// Fields

	private Integer id;
	private Store store;
	private String name;
	private Set<Food> foods = new HashSet<Food>(0);

	// Constructors

	/** default constructor */
	public Ftype() {
	}

	/** minimal constructor */
	public Ftype(Store store, String name) {
		this.store = store;
		this.name = name;
	}

	/** full constructor */
	public Ftype(Store store, String name, Set<Food> foods) {
		this.store = store;
		this.name = name;
		this.foods = foods;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "store_id", nullable = false)
	public Store getStore() {
		return this.store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@Column(name = "name", nullable = false, length = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "ftype")
	public Set<Food> getFoods() {
		return this.foods;
	}

	public void setFoods(Set<Food> foods) {
		this.foods = foods;
	}

}